# -*- coding:utf-8 -*-

# @Time    : 2023/8/20 22:52
# @Author  : zengwenjia
# @Email   : zengwenjia@lingxi.ai
# @File    : user_info.py
# @Software: LLM_internal

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class UserInfo(object):
    user_info_dict = {"本人年龄": "current_age", "期望退休年龄": "expect_retire_age",
                      "退休后每个月消费": "retire_cost", "本人性别": "sex",
                      "当前是否缴纳社保": "have_social_security", "通货膨胀率": "inflation_rate",
                      "理财收益率": "financial_management", "养老金收入涨幅": "persion_rise_rate",
                      "预期寿命": "max_age", "职工社保缴纳年龄": "start_security_age",
                      "职工社保缴纳年限": "start_security_num", "当前月收入": "total_revenue",
                      "当前存款": "retire_reserve_fund", "人生阶段": "life_phases", "是否已结婚": "is_married",
                      "剩余房贷总额": "remaining_mortgage_loan_amount", "孩子年龄": "children_age",
                      "孩子个数": "children_num", "孩子抚养费": "children_cost",
                      "父母年龄": "parents_age", "要赡养老人数": "parents_num", "父母赡养费": "parents_cost",
                      "当前月支出": "total_expenditure", "收入年度涨幅": "income_growth_rate",
                      "社保缴费基数": "monthly_payment_base", "每月社保扣费": "monthly_payment",
                      "参保城市": "city", "个人养老金余额": "pension_balance", "基础养老金": "basic_pension",
                      "参保城镇平均工资涨幅": "avg_wage_growth_rate", "退休前一年参保城镇平均工资": "ave_wage_last_year",
                      "预估法定退休年龄": "legal_retirement_age", "社保缴纳总年限": "total_years_pension_payment",
                      "个人养老金计算结果": "personal_pension_result", "基础养老金计算结果": "basic_pension_result",
                      "养老金计算结果": "pension_result", "年保费预算": "insurance_premium_budget",
                      "配偶年龄": "spouse_age", "配偶性别":"spouse_sex",
                      "当前年收入": "family_annual_income", "当前年支出": "family_annual_expenditure",
                      "孩子性别": "children_sex",
                      "被保人": "insurance_person",
                      "父母人生阶段": "parents_life_phases",
                      "孩子人生阶段": "children_life_phases"
                      }
# 配偶的人生阶段和本人保持一致
    user_info_rule = """
"本人年龄":XX(岁), 
"本人性别":"XX(男/女)", 
"是否已结婚":"是/否",
"人生阶段":"XX(入职期/初婚期/生育期/子女离家期/退休期)",
"当前年收入":XX(元), 
"当前年支出":XX(元),
"剩余房贷总额":XX(元), 
"父母赡养费":XX(元), 
"孩子抚养费":XX(元), 
"年保费预算":XX(元),
"要赡养老人数":XX(位), 
"父母年龄":XX(岁), 
"配偶年龄":XX(岁), 
"配偶性别":XX(男/女),
"孩子个数":XX(个), 
"孩子年龄":XX(岁), 
"孩子性别":XX(男/女),
"被保人":"XX(本人/配偶/孩子/父母)",
"父母人生阶段":"XX(生育期/子女离家期/退休期)",
"孩子人生阶段":"XX(婴儿期/低龄儿童/大龄儿童/低龄青少年/大龄青少年)",
"当前关注保险产品":"XX",
"本人职业":"XX",
"配偶职业":"XX",
"孩子职业":"XX",
"父母职业":"XX",
"地区":"XX",
"本人是否有社保":"XX",
"父母是否有社保":"XX",
"配偶是否有社保":"XX",
"孩子是否有社保":"XX",
"目的地":"XX(境外/境内)",
"本人健康状况":"XX",
"父母健康状况":"XX",
"孩子健康状况":"XX",

"""
    # 既往症、身体健康状况。。

    def __init__(self):
        pass

    # 根据中文名字获取英文名字
    @classmethod
    def get_english_name(cls, chinese_name):
        return cls.user_info_dict.get(chinese_name, None)

    # 将中文名的dict转换成英文名的dict
    @classmethod
    def get_english_dict(cls, chinese_dict):
        english_dict = {}
        if chinese_dict:
            for key, value in chinese_dict.items():
                name_key = cls.get_english_name(key)
                if name_key:
                    english_dict[name_key] = value
        return english_dict

    # 根据英文名字获取中文名字
    @classmethod
    def get_chinese_name(cls, english_name):
        for key, value in cls.user_info_dict.items():
            if value == english_name:
                return key
        return None

    # 将英文名的dict转换成中文名的dict
    @classmethod
    def get_chinese_dict(cls, english_dict):
        chinese_dict = {}
        if english_dict:
            for key, value in english_dict.items():
                name_key = cls.get_chinese_name(key)
                if name_key:
                    chinese_dict[name_key] = value
        return chinese_dict
